<?php
namespace app\index\controller;

use think\Request;

class Goods extends Common
{
	//店铺首页
    public function index(){
		return view();
    }
	
	//商品列表
    public function list(){
		
		$result = \ServerHelper::post('productlist',['agentid'=>AGENT_ID]);
		
		$list = $this->J($result);
		if(empty($list['data'])){
			exit();
		}

		return view('list',['data'=>$list['data']]);
    }
	
	//商品详情
    public function detail(){
		
		$id = Request::instance()->param('id');
		if(!\RegexHelper::is_id($id)){
			abort(404,'页面不存在');
		}
		
		$detail = \ServerHelper::post('goods_detail',['agentid'=>AGENT_ID,'productid'=>$id]);
		$data = $this->J($detail);

		return view('detail',['data'=>$data['data']]);
    }
	

	
}
